//
//  AbstractRequest.h
//  collection
//
//  Created by zhangjing on 4/3/12.
//  Copyright (c) 2012 Tsinghua University. All rights reserved.
//

#import "CRequestCommand.h"
#import "UserInfo.h"
#import "Feed.h"

// Request data by client
@interface RequestData : NSObject

@property (nonatomic, copy) NSString*   sessionKey;
@property (nonatomic)   long long UID;

@end


// Response from server
@interface Response : NSObject

@property (nonatomic)   int status;
@property (nonatomic, copy) NSString* message;

@end

// Request
@interface AbstractRequest : CRequestCommand

@property (nonatomic, copy) NSString*   descriptionName;    // e.g : relation.create
@property (nonatomic, retain)   RequestData* request;
@property (nonatomic, retain)   Response*   response;

// Need to be overriden
- (void)initParams;
- (NSString*)buildRequestURL;
- (void)parseResponse:(NSObject*)data;

// Call method
- (void)postRequest;

//
- (UserInfo*)parseOneUser:(NSDictionary*)userData;
- (Feed*)parseOneFeed:(NSDictionary*)feedData;

@end
